//
//  FGMessageCellData.h
//  FGChatKit
//
//  Created by Henry on 2020/8/13.
//  Copyright © 2020 Henry. All rights reserved.
//

#import "FGCommonTableViewCell.h"
#import "FGMessageCellLayout.h"
@class FGMessageCell;

NS_ASSUME_NONNULL_BEGIN

/// 消息状态枚举
typedef NS_ENUM(NSUInteger, FGMsgStatus) {
    /// 消息创建
    FGMsgStatusInit,
    /// 消息发送中
    FGMsgStatusSending,
    /// 消息发送成功
    FGMsgStatusSucc,
    /// 消息发送失败
    FGMsgStatusFail,
};

/// 消息方向枚举 消息方向影响气泡图标、气泡位置等 UI 风格
typedef NS_ENUM(NSUInteger, FGMsgDirection) {
    /// 消息接收
    FGMsgDirectionIncoming,
    /// 消息发送
    FGMsgDirectionOutgoing,
};

typedef void(^FGDownloadProgress)(NSUInteger progress);
typedef void(^FGSucc)(void);
typedef void(^FGFail)(int code, NSString *msg);

@interface FGMessageCellData : FGCommonCellData

/// 方便管理文件
@property (nonatomic, strong) NSString *conversationId;
/// 唯一ID
@property (nonatomic, strong) NSString *uuid;
/// 消息ID
@property (nonatomic, strong) NSString *msgId;

/// 发送方
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *sender;
/// 头像地址
@property (nonatomic, strong) NSString *avatarUrl;
/// 头像图片
@property (nonatomic, strong) UIImage *avatarImage;

/// 时间戳
@property (nonatomic, copy) NSString *time;

/// 已读 未读 已读时间戳
@property (nonatomic, strong) NSString *isread;

@property (nonatomic, assign) BOOL showName;
@property (nonatomic, assign) BOOL showTime;

@property (nonatomic, assign) FGMsgDirection direction;
@property (nonatomic, assign) FGMsgStatus status;

/// 额外数据
@property (nonatomic, strong) id innerMessage;
@property (nonatomic, strong) NSDictionary *innerData;

/// 设置相关
@property (nonatomic, strong) UIFont *timeFont;
@property (nonatomic, strong) UIColor *timeColor;
@property (nonatomic, strong) UIFont *nameFont;
@property (nonatomic, strong) UIColor *nameColor;

@property FGMessageCellLayout *cellLayout;


- (CGSize)contentSize;
- (instancetype)initWithDirection:(FGMsgDirection)direction;


/// 自定义Cell，只需要绑定identifier， 返回Cell类名
+ (NSString *)reuseIdentifier;
/// 注册Cell
+ (void)registerCellToTableView:(UITableView *)tableView;
/// 使用Cell
- (FGMessageCell *)dequeueCellByTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath;

- (BOOL)isSelf;

@end

NS_ASSUME_NONNULL_END
